package javaExer.草稿;

public class 数组合并 {

    public static void main(String[] args) {

        int[] arr1 = {1,2,3,4};
        int[] arr2 = {5,6,7,8};

        int len = arr1.length+arr2.length;
        int[] newArr = new int[len];

        for (int i = 0; i < arr1.length ; i++) {
            newArr[i]=arr1[i];
        }
        for (int i = 0; i < arr2.length; i++) {
            newArr[arr1.length+i]=arr2[i];
        }

        for (int i = 0; i < newArr.length; i++) {
            System.out.print(newArr[i]+" ");
        }
    }
}
